# @Version        : 1.0
# @Update Time    : 2025/8/23 0:00
# @File           : health.py
# @IDE            : PyCharm
# @Desc           : 健康检查路由
from fastapi import APIRouter
from fastapi.responses import JSONResponse

router = APIRouter(prefix="/health", tags=["健康检查"])


@router.get("/")
def health_check():
    """
    健康检查端点
    返回应用的健康状态
    """
    return JSONResponse(status_code=200, content={"status": "ok", "message": "Application is running normally"})


@router.get("/detail")
def health_check_detail():
    """
    详细健康检查端点
    可用于检查数据库连接等更详细的健康状态
    """
    # 这里可以添加数据库连接检查等更详细的健康检查逻辑
    return JSONResponse(
        status_code=200,
        content={
            "status": "ok",
            "message": "Application and dependencies are running normally",
            "details": {"database": "connected", "cache": "available"},
        },
    )
